fix: rebase prebuilt artifact paths across platforms#73
Conversation
Greptile SummaryThis PR removes the explicit
Confidence Score: 4/5Safe to merge; the logic change is small, well-scoped, and the happy path is covered by tests. The refactored crates/alien-cli/src/commands/release.rs — specifically the new test at line 1614 which doesn't fully validate the cross-platform scenario it claims to cover.
|
| Filename | Overview |
|---|---|
| crates/alien-cli/src/commands/release.rs | Core logic change: platform parameter removed from rebase helpers; platform now extracted from the artifact path itself via artifact_location_from_build_path. New cross-platform test added but its isolation from the same-platform test is weak. |
| Cargo.lock | Workspace-wide version bump from 1.6.0 to 1.7.1 for all alien-* crates; no substantive changes. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["release_task_core(platform=gcp, --prebuilt)"] --> B["rebase_prebuilt_stack_image_paths(stack, output_dir)"]
B --> C["for each Worker / Container / Daemon"]
C --> D["rebase_prebuilt_image_path(resource_type, id, image, output_dir)"]
D --> E{"image_path.exists()?"}
E -- yes --> F["return Ok(None)"]
E -- no --> G["artifact_location_from_build_path(image_path)"]
G --> H{"path contains .alien/build/p/a?"}
H -- yes --> J["extract (artifact_platform, artifact_dir)"]
J --> K["rebased = output_dir/build/{artifact_platform}/{artifact_dir}"]
K --> L{"rebased exists && is_dir?"}
L -- yes --> M["return Ok(Some(rebased))"]
L -- no --> N["return Err(ValidationError)"]
H -- no --> I{"absolute or relative path?"}
I -- yes --> O["return Err(ValidationError)"]
I -- no --> P["return Ok(None) — remote URI"]
Comments Outside Diff (1)
-
crates/alien-cli/src/commands/release.rs, line 1614-1637 (link)Test doesn't demonstrate the new cross-platform behaviour
The new test and the existing
rebase_prebuilt_stack_image_paths_rewrites_copied_artifact_pathare structurally identical: both set up an artifact whose path and on-disk location use the same platform (gcp/awsrespectively). The distinguishing claim — that a release targeting one platform correctly reuses an artifact built under a different platform — is invisible here becauseplatformis no longer passed in at all. A more informative test would create an artifact underaws/while naming the resource in a way that makes it clear the release context isgcp. As written, ifartifact_location_from_build_pathwere accidentally reverted to requirewindow[2] == "aws", this test would still pass.Prompt To Fix With AI
This is a comment left during a code review. Path: crates/alien-cli/src/commands/release.rs Line: 1614-1637 Comment: **Test doesn't demonstrate the new cross-platform behaviour** The new test and the existing `rebase_prebuilt_stack_image_paths_rewrites_copied_artifact_path` are structurally identical: both set up an artifact whose path and on-disk location use the same platform (`gcp`/`aws` respectively). The distinguishing claim — that a release targeting one platform correctly reuses an artifact built under a different platform — is invisible here because `platform` is no longer passed in at all. A more informative test would create an artifact under `aws/` while naming the resource in a way that makes it clear the release context is `gcp`. As written, if `artifact_location_from_build_path` were accidentally reverted to require `window[2] == "aws"`, this test would still pass. How can I resolve this? If you propose a fix, please make it concise.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 1
crates/alien-cli/src/commands/release.rs:1614-1637
**Test doesn't demonstrate the new cross-platform behaviour**
The new test and the existing `rebase_prebuilt_stack_image_paths_rewrites_copied_artifact_path` are structurally identical: both set up an artifact whose path and on-disk location use the same platform (`gcp`/`aws` respectively). The distinguishing claim — that a release targeting one platform correctly reuses an artifact built under a different platform — is invisible here because `platform` is no longer passed in at all. A more informative test would create an artifact under `aws/` while naming the resource in a way that makes it clear the release context is `gcp`. As written, if `artifact_location_from_build_path` were accidentally reverted to require `window[2] == "aws"`, this test would still pass.
Reviews (1): Last reviewed commit: "chore: format files checked by ci" | Re-trigger Greptile
Summary
Validation